package vashion.azeroth.core.activity;

import java.util.ArrayList;
import java.util.List;


/**
 * 各种不同活动的schemainfo<BR/>
 * 每一种活动的schema内容包括： schemaName:schemaDesc
 * <p/>
 * 创建时间: 2014-06-17
 */
public enum ActiveSchemaEnum {

    // 洋桃首页banner(包括三种方式: 直播id/搜索规则/超链接)
    YANGTAO_INDEX_BANNER_TYPE(1, "好物Banner活动",
            ActiveConstant.SCHEMA_SORTED + ":排序;link:超链接;img:背景图片(640x280);title:主标题;",
            ActiveContentUnitType.DEFAULT),

    NEW_YANGTAO_INDEX_JINGXUAN(2, "好物商品列表",
            ActiveConstant.SCHEMA_SORTED + ":排序;" + ActiveConstant.SCHEMA_ITEM_ID + ":商品id;itemRecommend:商品推荐理由;itemTitle:商品标题;itemPic:商品图片",
            ActiveContentUnitType.ITEM);
    ;

    final private int activityType;

    final private String descName;

    final private String attributes; //即schmea信息

    final private ActiveContentUnitType activeContentUnitType;

    ActiveSchemaEnum(int activityType, String descName, String attributes,
                     ActiveContentUnitType activeContentUnitType) {
        this.activityType = activityType;
        this.descName = descName;
        this.attributes = attributes;
        this.activeContentUnitType = activeContentUnitType;
    }

    /**
     * 由于部分schema废弃，因此部分schema将不予展示在后台页面
     */
    public static ActiveSchemaEnum[] valuesShow() {
        List<ActiveSchemaEnum> resultShowList = new ArrayList<ActiveSchemaEnum>();
        for (ActiveSchemaEnum activeSchemaEnum : values()) {
            resultShowList.add(activeSchemaEnum);
        }
        ActiveSchemaEnum[] resultReturn = new ActiveSchemaEnum[resultShowList.size()];
        resultReturn = resultShowList.toArray(resultReturn);
        return resultReturn;
    }

    public static ActiveSchemaEnum valueOf(int activityType) {
        ActiveSchemaEnum t = null;
        for (ActiveSchemaEnum tt : ActiveSchemaEnum.values()) {
            if (tt.getActivityType() == activityType) {
                t = tt;
                break;
            }
        }
        return t;
    }

    public ActiveContentUnitType getActiveContentUnitType() {
        return activeContentUnitType;
    }

    public int getActivityType() {
        return activityType;
    }

    public String getDescName() {
        return descName;
    }

    public String getAttributes() {
        return attributes;
    }

}